<?php


namespace app\user\controller;


use think\Controller;
use think\Db;

class Goods extends Base
{

    public function GoodsList(){
        $type = Param('goods');
        if ($type == 500){
            $goods_type = 1;
        }elseif ($type == 1000){
            $goods_type = 2;
        }else{
            $goods_type = 1;
        }
        $Goods = Db::name('goods_mall')->where(['is_shelf'=>2,'goods_type'=>$goods_type])->select();
        $this->assign('goods',$Goods);
        $this->assign('Count',count($Goods));
        return $this->fetch('GoodsList');
    }

    public function GoodsDetail(){
        $id = Param('id');
        $detail = Db::name('goods_mall')->find($id);
        $detail['banner'] = explode(',',$detail['album']);
        $this->assign('detail',$detail);
        return $this->fetch('GoodsDetail');
    }
}